package com.tinyengine.it.common.utils;

import java.util.Arrays;
//varchar
//int
//        decimal
//boolean
//        datetime
//text
//        blob
//object
//        file
//List<Object>

public enum JavaDataType {
    String("STRING"),
    Boolean("BOOLEAN"),
    Double("DOUBLE"),
    Blob("BLOB"),
    File("FILE"),
    DateTime("DATETIME"),
    Date("DATE"),
    Object("OBJECT"),
    List_Object("LIST<OBJECT>"),
    Page_Object("PAGE<OBJECT>"),
    Other("OTHER");

    private final String value;

    JavaDataType(String value) {
        this.value = value;
    }

    public String getValue() {
        return value;
    }
    //通过 value 查找枚举
    public static JavaDataType fromValue(String value) {
        return Arrays.stream(JavaDataType.values())
                .filter(type -> type.value.equalsIgnoreCase(value)).findFirst().orElse(Other);
    }
}
